1011 Disable full stack trace when using spark connect#1024
Merged
edublancas merged 13 commits intoploomber:masterfrom Jan 8, 2025
Merged
Conversation
…ould-not-print-full-stack-trace
b1ackout
commented
Sep 2, 2024
Comment on lines
+566
to
+572
| is_pyspark_analysis_exception = ( | ||
| isinstance(error, AnalysisException) if AnalysisException else False | ||
| ) | ||
| return ( | ||
| any(msg in str(error) for msg in specific_db_errors) | ||
| or is_pyspark_analysis_exception | ||
| ) |
Author
There was a problem hiding this comment.
If AnalysisException is imported then checks if the error is of instance of pyspark's Analysis Exception and handles it accordingly
b1ackout
commented
Sep 2, 2024
Comment on lines
+11
to
+15
| try: | ||
| from pyspark.sql.utils import AnalysisException | ||
| except ModuleNotFoundError: | ||
| AnalysisException = None | ||
|
|
Author
There was a problem hiding this comment.
This is to handle the case where pyspark module is not installed
b1ackout
commented
Sep 2, 2024
|
|
||
| def handle_spark_dataframe(dataframe, should_cache=False): | ||
| """Execute a ResultSet sqlaproxy using pysark module.""" | ||
| """Execute a ResultSet sqlaproxy using pyspark module.""" |
b1ackout
commented
Sep 2, 2024
| """Execute a ResultSet sqlaproxy using pyspark module.""" | ||
| if not DataFrame and not CDataFrame: | ||
| raise exceptions.MissingPackageError("pysark not installed") | ||
| raise exceptions.MissingPackageError("pyspark not installed") |
b1ackout
commented
Sep 2, 2024
Comment on lines
-559
to
-561
| # Pyspark | ||
| "UNRESOLVED_ROUTINE", | ||
| "PARSE_SYNTAX_ERROR", |
Author
There was a problem hiding this comment.
Removed these as they are included in AnalysisException
4 tasks
Author
|
@edublancas happy new year! |
edublancas
approved these changes
Jan 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
short_errorsis enabled to show only the spark sql error and not the full stack traceIssue number
Closes #1011
Checklist before requesting a review
pkgmt format📚 Documentation preview 📚: https://jupysql--1024.org.readthedocs.build/en/1024/